package com.abaddon.controller;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;

import com.abaddon.view.Abaddon;
import com.abaddon.view.R;
import com.google.android.maps.GeoPoint;

public class YesNoChoiceController implements Runnable{

	private Abaddon abaddon = null;
	private GeoPoint geoPoint = null;
	
	public YesNoChoiceController(Abaddon abaddon, GeoPoint geoPoint){
		this.abaddon = abaddon;
		this.geoPoint = geoPoint;
	}
	
	public void run() {
		new AlertDialog.Builder(abaddon)
		.setIcon(android.R.drawable.ic_dialog_alert)
		.setTitle(R.string.addPlace)
		.setMessage(R.string.addPlaceQuestion)
		.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
			
			@Override
            public void onClick(DialogInterface dialog, int which) {
				
				Intent newTagViewIntent = new Intent("com.abaddon.view.EDITPLACEVIEW");
				
				newTagViewIntent.putExtra("event", "newPlace");
				newTagViewIntent.putExtra("latitude", geoPoint.getLatitudeE6());
				newTagViewIntent.putExtra("longitude", geoPoint.getLongitudeE6());
				
				abaddon.startActivity(newTagViewIntent);
				
            }

		})
		.setNegativeButton(R.string.no, null)
		.show();
	}
	
}
